import React from 'react';
import { format } from '@/utils/datetime';
import CommonPage from '@/components/page/CommonPage';
import { renderNumber } from '@/utils/common';
const daoName = 'ShCompTyhq';
const importName = 'ShCompTyhq';

const columns: API.Column[] = [
  {
    title: '日期',
    width: 110,
    sorter: true,
    key: 'DTID',
    dataIndex: 'DTID',
    render: (data: any) => format(data, 'yyyy-MM-dd'),
    dispaly: true,
    filter: true,
    export: false,
  },
  {
    title: '机构号',
    width: 110,
    sorter: true,
    dataIndex: 'JGH',
    key: 'JGH',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '账号',
    width: 220,
    sorter: true,
    dataIndex: 'ACNO',
    key: 'ACNO',
    dispaly: true,
    filter: true,
    export: true,
    ellipsis: true,
  },
  {
    title: '户名',
    width: 300,
    sorter: true,
    dataIndex: 'CUNM',
    key: 'CUNM',
    dispaly: true,
    filter: true,
    export: true,
    ellipsis: true,
  },
  {
    title: '余额',
    width: 140,
    sorter: true,
    dataIndex: 'ACBL',
    key: 'ACBL',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '利率',
    width: 110,
    sorter: true,
    dataIndex: 'INRT',
    key: 'INRT',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '类定期基数',
    width: 140,
    sorter: true,
    dataIndex: 'LDQJS',
    key: 'LDQJS',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '上月底积数',
    width: 160,
    sorter: true,
    dataIndex: 'YDJS12',
    key: 'YDJS12',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '本月底积数',
    width: 160,
    sorter: true,
    dataIndex: 'YDJS1',
    key: 'YDJS1',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '本月日均',
    width: 160,
    sorter: true,
    dataIndex: 'AVVL',
    key: 'AVVL',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '利润计算',
    width: 130,
    sorter: true,
    dataIndex: 'JSLR',
    key: 'JSLR',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '利润贡献',
    width: 140,
    sorter: true,
    dataIndex: 'LLGX',
    key: 'LLGX',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '本月分配利润数',
    width: 150,
    sorter: true,
    dataIndex: 'FPLRS1',
    key: 'FPLRS1',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '绩费',
    width: 120,
    sorter: true,
    dataIndex: 'JF',
    key: 'JF',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '工号1',
    width: 100,
    sorter: true,
    dataIndex: 'GH1',
    key: 'GH1',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '客户经理1',
    width: 130,
    sorter: true,
    dataIndex: 'KHJL1',
    key: 'KHJL1',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比1',
    width: 80,
    sorter: true,
    dataIndex: 'ZB1',
    key: 'ZB1',
    dispaly: true,
    filter: false,
    export: true,
  },
  {
    title: '工号2',
    width: 100,
    sorter: true,
    dataIndex: 'GH2',
    key: 'GH2',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '客户经理2',
    width: 130,
    sorter: true,
    dataIndex: 'KHJL2',
    key: 'KHJL2',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比2',
    width: 80,
    sorter: true,
    dataIndex: 'ZB2',
    key: 'ZB2',
    dispaly: true,
    filter: false,
    export: true,
  },
  {
    title: '工号3',
    width: 100,
    sorter: true,
    dataIndex: 'GH3',
    key: 'GH3',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '客户经理3',
    width: 130,
    sorter: true,
    dataIndex: 'KHJL3',
    key: 'KHJL3',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比3',
    width: 80,
    sorter: true,
    dataIndex: 'ZB3',
    key: 'ZB3',
    dispaly: true,
    filter: false,
    export: true,
  },
];
const controls: API.Control[] = [
  { name: 'DTID', dataType: 'date', type: 'date', label: '日期', grid: 12 / 24 },
  { name: 'JGH', type: 'text', label: '机构号', grid: 12 / 24 },
  { name: 'ACNO', type: 'text', label: '账号', grid: 12 / 24 },
  { name: 'CUNM', type: 'text', label: '户名', grid: 12 / 24 },
  { name: 'ACBL', type: 'number', dataType: 'number', label: '余额', grid: 12 / 24 },
  { name: 'INRT', type: 'number', dataType: 'number', label: '利率', grid: 12 / 24 },
  { name: 'LDQJS', type: 'number', dataType: 'number', label: '类定期基数', grid: 12 / 24 },
  { name: 'YDJS12', type: 'number', dataType: 'number', label: '上月底积数', grid: 12 / 24 },
  { name: 'YDJS1', type: 'number', dataType: 'number', label: '本月底积数', grid: 12 / 24 },
  { name: 'AVVL', type: 'number', dataType: 'number', label: '本月日均', grid: 12 / 24 },
  { name: 'JSLR', type: 'number', dataType: 'number', label: '利润计算', grid: 12 / 24 },
  { name: 'LLGX', type: 'number', dataType: 'number', label: '利润贡献', grid: 12 / 24 },
  { name: 'FPLRS1', type: 'number', dataType: 'number', label: '本月分配利润数', grid: 12 / 24 },
  { name: 'JF', type: 'number', dataType: 'number', label: '绩费', grid: 12 / 24 },
  { name: 'GH1', type: 'text', label: '工号1', grid: 12 / 24 },
  { name: 'KHJL1', type: 'text', label: '客户经理1', grid: 12 / 24 },
  { name: 'ZB1', type: 'number', dataType: 'number', label: '占比1', grid: 12 / 24 },
  { name: 'GH2', type: 'text', label: '工号2', grid: 12 / 24 },
  { name: 'KHJL2', type: 'text', label: '客户经理2', grid: 12 / 24 },
  { name: 'ZB2', type: 'number', dataType: 'number', label: '占比2', grid: 12 / 24 },
  { name: 'GH3', type: 'text', label: '工号3', grid: 12 / 24 },
  { name: 'KHJL3', type: 'text', label: '客户经理3', grid: 12 / 24 },
  { name: 'ZB3', type: 'number', dataType: 'number', label: '占比3', grid: 12 / 24 },
];

const controlsImport: API.Control[] = [
  { name: 'DTID', dataType: 'date', type: 'month', label: '日期', grid: 12 / 24 },
  { name: 'JGH', type: 'text', label: '机构号', grid: 12 / 24 },
  { name: 'ACNO', type: 'text', label: '账号', grid: 12 / 24 },
  { name: 'CUNM', type: 'text', label: '户名', grid: 12 / 24 },
  { name: 'ACBL', type: 'number', dataType: 'number', label: '余额', grid: 12 / 24 },
  { name: 'INRT', type: 'number', dataType: 'number', label: '利率', grid: 12 / 24 },
  { name: 'LDQJS', type: 'number', dataType: 'number', label: '类定期基数', grid: 12 / 24 },
  { name: 'YDJS12', type: 'number', dataType: 'number', label: '上月底积数', grid: 12 / 24 },
  { name: 'YDJS1', type: 'number', dataType: 'number', label: '本月底积数', grid: 12 / 24 },
  { name: 'AVVL', type: 'number', dataType: 'number', label: '本月日均', grid: 12 / 24 },
  { name: 'JSLR', type: 'number', dataType: 'number', label: '利润计算', grid: 12 / 24 },
  { name: 'LLGX', type: 'number', dataType: 'number', label: '利润贡献', grid: 12 / 24 },
  { name: 'FPLRS1', type: 'number', dataType: 'number', label: '本月分配利润数', grid: 12 / 24 },
  { name: 'JF', type: 'number', dataType: 'number', label: '绩费', grid: 12 / 24 },
  { name: 'GH1', type: 'text', label: '工号1', grid: 12 / 24 },
  { name: 'KHJL1', type: 'text', label: '客户经理1', grid: 12 / 24 },
  { name: 'ZB1', type: 'number', dataType: 'number', label: '占比1', grid: 12 / 24 },
  { name: 'GH2', type: 'text', label: '工号2', grid: 12 / 24 },
  { name: 'KHJL2', type: 'text', label: '客户经理2', grid: 12 / 24 },
  { name: 'ZB2', type: 'number', dataType: 'number', label: '占比2', grid: 12 / 24 },
  { name: 'GH3', type: 'text', label: '工号3', grid: 12 / 24 },
  { name: 'KHJL3', type: 'text', label: '客户经理3', grid: 12 / 24 },
  { name: 'ZB3', type: 'number', dataType: 'number', label: '占比3', grid: 12 / 24 },
];

const ShCompTyhqForm: React.FC = () => {
  return (
    <CommonPage
      daoName={daoName}
      columns={columns}
      controls={controls}
      title="员工信息"
      importName={importName}
      importControls={controlsImport}
      importMode="DeleteAfterInsert"
      importParamNames={['DTID']}
      keyColName="ID"
      importTemplateName="同业活期台账导入"
      initSorter={{ FieldName: 'DTID', Direction: 'DESC' }}
    />
  );
};

export default ShCompTyhqForm;
